package liangtWorkSpace.simple;

import java.util.ArrayList;

/**
 * @author liangt
 * @ClassName: Merge
 * @title: Merge
 * @projectName liangtWorkSpace.simple
 * @description: TODO
 * @date 2020/10/23 11:48
 */
public class Merge {
    public void merge(int[] nums1, int m, int[] nums2, int n) {
        int i = m--+--n;
        while (n>=0){
            nums1[i--] = m>=0 && nums1[m] >= nums2[n]?nums1[m--]:nums2[n--];
        }
        for (int a : nums1){
            System.out.print(a);
        }
    }

    public static void main(String[] args) {
        int[] a = new int[]{1,2,3,0,0,0};
        int[] b = new int[]{2,5,6};
        new Merge().merge(a,3,b,3);
    }
}